home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 April / EnigmA AMIGA RUN 06 (1996)(G.R. Edizioni)(IT)[!][issue 1996-04][Skylink CD V].iso / progs / editor / write-ed / rexx / oberonerror.wrx < prev    next >
Text File  |  1995-07-20  |  3KB  |  170 lines

  1. /*
  2.  * REXX-SCRIPT für WRITE V 4.97
  3.  * Dies Script unterstützt den Umgang mit dem
  4.  * Amiga Oberon Compiler 3.0 von A+L.
  5.  * Dieses Script mit den Parametern FIRST, CURRENT, PREV, NEXT oder LIST aus
  6.  * dem aktuellen Text heraus starten.
  7.  *
  8.  *
  9.  *  $VER: oberonerror.wrx 1.1 (20-7-95)
  10.  *
  11.  *  History:
  12.  *
  13.  *  1.1 fixed bug with filenames ending in uppercase forms of ".mod"
  14.         transformed " !" to "!" [TT]
  15.  *  1.0 initial Version
  16.  *
  17.  */
  18.  
  19. IF ~show('P',"WRITE")
  20. THEN DO
  21.  say 'Dieses Script läuft nur, wenn WRITE bereits gestartet wurde !'
  22.  exit 10
  23. END
  24.  
  25. ADDRESS "WRITE"
  26.  
  27. OPTIONS RESULTS
  28.  
  29. 'VERSIONCHECK 40000 "OberonError.wrx"'
  30. IF RC~=0 THEN DO
  31.   exit 10
  32. END
  33.  
  34. /*** Argumentkontrolle ***/
  35.  
  36. arg what
  37. if (what ~= "FIRST") & (what ~= "NEXT") & (what ~= "CURRENT") & (what ~= "PREV") & (what~="LIST") then do
  38.   "MESSAGEOK (Fehler:\nDieses Script muß mit FIRST, CURRENT, PREV oder LIST\nals Argument aufgerufen werden !)"
  39.   exit
  40. end
  41.  
  42. /*** Open oberonsupport.library ***/
  43.  
  44. libname = "oberonsupport.library"
  45.  
  46. if ~show("L", libname) then do
  47.   if ~addlib(libname, 0, -30, 1) then do
  48.     text = "Fehler :\n'" || libname "'\n" || "konnte nicht gefunden werden"
  49.     MESSAGEOK text
  50.   end
  51. end
  52.  
  53. /*** Filenamen holen ***/
  54.  
  55. "GETVAR (_File)" /* Nur Filenamen (ohne Pfad) holen */
  56. filename = result
  57.  
  58. if filename = "" then do
  59.   "MESSAGEOK (Fehler:\nKein Filename)"
  60.   exit
  61. end
  62.  
  63. "GETVAR (_FileName)" /* Kompletten Filenamen (mit Pfad) holen */
  64. filename = result
  65.  
  66. suffix = right(filename,4)
  67. upper suffix
  68. if suffix ~= ".MOD" then do
  69.   "MESSAGEOK (Fehler:\n'$_File$'\nist kein Oberon Sourcecode!)"
  70.   exit
  71. end
  72.  
  73. filename = filename || 'E'
  74.  
  75. /*** Enthält Fehler ? ***/
  76.  
  77. count = GETERRCOUNT(filename)
  78. if count < 0 then do
  79.   "MESSAGEOK ('$_File$'\nenthält keine Fehler!)"
  80.   exit
  81. end
  82.  
  83. cnt = getclip("CurrentError")
  84.  
  85. if cnt = "" then do
  86.   cnt = 0
  87. end
  88.  
  89. if what = "LIST" then do
  90.   ShowErrorList()
  91. end
  92. if what = "FIRST" then do
  93.   cnt = 0
  94. end;
  95. if what = "NEXT" then do
  96.   cnt = cnt+1
  97. end;
  98. if what = "PREV" then do
  99.   cnt = cnt-1
  100. end
  101.  
  102. if cnt >= count then do
  103.   "MESSAGEOK ('$_File$'\nenthält keine weiteren Fehler!)"
  104.   exit
  105. end
  106.  
  107. if cnt < 0 then do
  108.   "MESSAGEOK (Erster Fehler\nbereits erreicht!)"
  109.   exit
  110. end
  111.  
  112. if ~GETERROR(filename, cnt, Error.) then do
  113.   "MESSAGEOK (Fehler:\nKann Fehlerdatei nicht laden!)"
  114.   exit
  115. end
  116.  
  117. GOTO Error.column Error.line
  118.  
  119. text = "Fehler Nr." cnt+1 "von" count || ":\n" || "`" || GETERRORTEXT(Error.num) || "'"
  120. text = Translate(text,"<>","()")
  121.  
  122. MESSAGEOK "(" || text || ")"
  123.  
  124. if ~setclip("CurrentError",cnt) then do
  125.   "MESSAGEOK (Fehler:\nKann mir aktuellen Fehler nicht merken!)"
  126. end
  127.  
  128. exit 0
  129.  
  130. ShowErrorList:
  131.  
  132. CLEARLIST 0
  133.  
  134. do x = 0 to count-1
  135.   if GETERROR(filename, x, Error.) then do
  136.     text = x+1 || " " || "`" || GETERRORTEXT(Error.num) || "'"
  137.     text = Translate(text,"<>","()")
  138.     ADDLIST "(" || text || ")" 0
  139.   end
  140. end
  141.  
  142. SHOWLIST 0 cnt "{@SELECT}"
  143.  
  144. if RC = 0 then do
  145.   Text = result
  146.   if Text~="" then do
  147.     Error = Word(Text,1)
  148.     cnt = Value(Error) - 1
  149.  
  150.     if ~GETERROR(filename, cnt, Error.) then do
  151.       "MESSAGEOK (Fehler:\nKann Fehlerdatei nicht laden!)"
  152.       exit
  153.     end
  154.  
  155.     GOTO Error.column Error.line
  156.  
  157.     text = "Fehler Nr." cnt+1 "von" count || ":\n" || "`" || GETERRORTEXT(Error.num) || "'"
  158.     text = Translate(text,"<>","()")
  159.  
  160.     MESSAGEOK "(" || text || ")"
  161.  
  162.     if ~setclip("CurrentError",cnt) then do
  163.       "MESSAGEOK (Fehler:\nKann mir aktuellen Fehler nicht merken!)"
  164.     end
  165.   end
  166. end
  167.  
  168. exit 0
  169.  
  170.